#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    string removeDuplicates(string s) {
        string st;
        for (auto& e : s)
        {
            if (st.empty() || st.back() != e) st.push_back(e);
            else if (st.back() == e) st.pop_back();
        }
        return st;
    }
};